package com.ssy.lingxi.order.service.base;

import com.ssy.lingxi.common.model.dto.UserLoginCacheDTO;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.order.entity.DeliveryOrderDO;
import com.ssy.lingxi.order.entity.OrderDO;
import com.ssy.lingxi.order.entity.ReceiveOrderDO;
import com.ssy.lingxi.order.model.bo.OrderDeliveryBO;
import com.ssy.lingxi.order.model.bo.OrderReceiveBO;
import com.ssy.lingxi.order.model.vo.basic.request.ProductReceiveOrDeliveryVO;
import com.ssy.lingxi.order.model.vo.basic.response.BuyerOrderDeliveryDetailVO;
import com.ssy.lingxi.order.model.vo.basic.response.VendorOrderDeliveryDetailVO;
import com.ssy.lingxi.order.model.vo.platform.response.PlatformOrderDeliveryDetailVO;
import com.ssy.lingxi.order.model.vo.vendor.request.VendorDeliveryVO;

import java.util.List;

/**
 * 订单收货-发货相关接口
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-20
 */
public interface IBaseOrderDeliveryService {

    /**
     * 查询采购商订单收发货明细
     * @param order 订单
     * @return 收发货统计
     */
    List<BuyerOrderDeliveryDetailVO> listBuyerOrderDeliveryDetails(OrderDO order);

    /**
     * 查询供应商订单收发货明细
     * @param order 订单
     * @return 收发货统计
     */
    List<VendorOrderDeliveryDetailVO> listVendorOrderDeliveryDetails(OrderDO order);

    /**
     * 平台后台 - 查询订单收发货明细
     * @param order 订单
     * @return 收发货统计
     */
    List<PlatformOrderDeliveryDetailVO> listOrderDeliveryDetails(OrderDO order);

    /**
     * 供应订单发货
     * @param order      订单
     * @param deliveryVO 接口参数
     * @return 发货结果
     */
    Wrapper<OrderDeliveryBO> checkVendorOrderDelivery(OrderDO order, VendorDeliveryVO deliveryVO);

    /**
     * 采购订单收货
     * @param order       订单
     * @param batchNo     发货批次
     * @param receiveBill 收货回单url地址
     * @return 收货结果
     */
    Wrapper<OrderReceiveBO> checkBuyerOrderReceive(OrderDO order, Integer batchNo, String receiveBill);

    /**
     * 采购Srm订单收货后，将收货数据通过MQ发送给结算服务
     * @param order   订单
     * @param batchNo 发货批次
     */
    void notifySrmOrderReceive(OrderDO order, Integer batchNo);

    /**
     * （新增收货单）采购Srm订单收货后，将收货数据通过MQ发送给结算服务
     * @param orders     订单
     * @param deliveryNo 发货单号
     */
    void notifySrmOrderReceive(List<OrderDO> orders, String deliveryNo);

    /**
     * 新增送货单 - 更新销售订单发货数量和工作流内外部状态
     * @param loginUser     登录用户信息
     * @param deliveryOrder 送货单信息
     * @param productVO     商品发货数量
     * @return 返回结果
     */
    Wrapper<Void> checkCreateVendorDelivery(UserLoginCacheDTO loginUser, DeliveryOrderDO deliveryOrder, List<ProductReceiveOrDeliveryVO> productVO);

    /**
     * 新增收货单 - 更新采购订单发货数量和工作流内外部状态
     * @param loginUser    登录用户信息
     * @param receiveOrder 收货单
     * @param productVO    商品收货数量
     * @return 发货结果
     */
    Wrapper<Void> checkCreateBuyerReceive(UserLoginCacheDTO loginUser, ReceiveOrderDO receiveOrder, List<ProductReceiveOrDeliveryVO> productVO);
}
